<!doctype html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>全部订单</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/index.css" />
</head>
<body>
<div class="order">
    <div class="tabber"><span onclick="header(0)" <eq name="type" value="0"> class="on"</eq>>全部</span><span onclick="header(3)" <eq name="type" value="3"> class="on"</eq>>待付款</span><span onclick="header(2)" <eq name="type" value="2"> class="on"</eq>>待发货</span><span onclick="header(4)" <eq name="type" value="4"> class="on"</eq>>已发货</span><span onclick="header(5)" <eq name="type" value="5"> class="on"</eq>>待评价</span><span onclick="header(6)" <eq name="type" value="6"> class="on"</eq>>已评价</span></div>
    <div class="orderlist">
        <div class="block">
            <ul>
                <volist name="wholesale" id="ws">
                    <li>
                        <div class="tit">订单状态<span>
                            <switch name="ws['state']">
                                <case value="3">等待买家付款</case>
                                <case value="2">待发货</case>
                                <case value="4">农户已发货</case>
                                <case value="5">交易成功</case>
                                <case value="6">买家已评价</case>
                            </switch></span></div>
                        <div class="pro" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'">
                            <div class="pic"><img src="<?=isMorePic($ws['store']['h_imgs'])?>"/></div>
                            <div class="name">
                                <h2>{$ws.store.title} {$ws.store.u_num}<?=getunit($ws['store']['unit'])?></h2>
                                <p><b><img src="{$ws.member.avatar}"/></b><i>{$ws.member.nickname}</i><em>{$ws.willage}</em></p>
                                <h3><del>原价：{$ws.store.price}</del><em>￥{$ws.price}</em><i class="qj">（{$ws.price_range.start}-{$ws.price_range.end}件）</i><b class="sl">X{$ws.num}</b></h3>
                            </div>
                        </div>
                        <div class="total">共<b>1</b>件商品<span>合计：<i>￥{$ws.price_all}+{$ws.price_charge}</i></span></div>
                        <div class="button">
                            <switch name="ws['state']">
                                <case value="3">
                                    <input type="button" class="delete" value="取消订单" onclick="dele(this,{$ws['id']})" style="background:#fff; border:1px #666666 solid; margin-right:10px; color:#666;"/><input type="button" value="立即付款" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'"/>
                                </case>
                                <case value="2">
                                    <input type="button" value="提醒发货" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'" style="background:#fff; border:1px #666666 solid; color:#666;"/>
                                </case>
                                <case value="4">
                                    <input type="button" value="查看物流" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'" style="background:#fff; border:1px #666666 solid; margin-right:10px; color:#666; "onClick="window.location='logistics.html'"/>
                                </case>
                                <case value="5">
                                    <input type="button" value="查看物流" onClick="window.location='__MODULE__/WholesaleOrder/logistics'" style="background:#fff; border:1px #666666 solid; margin-right:10px; color:#666;" onClick="window.location='logistics.html'"/><input type="button" value="发表评价" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'"/>
                                </case>
                                <case value="6">
                                    <input type="button" value="查看评价"  style="background:#fff; border:1px #666666 solid;color:#666;" onClick="window.location='__MODULE__/WholesaleOrder/detail/id/{$ws.id}'"/>
                                </case>
                            </switch>
                        </div>
                    </li>
                </volist>
            </ul>
        </div>
    </div>
    <div class="notes">
        <div class="inner">
            <h2><img src="__PUBLIC__/Wx/img/success03.png"/></h2>
            <h3>取消成功！</h3>
        </div>
    </div>
</div>
<!--悬浮公用导航-->
<include file="Public:nav" />
<script type="text/javascript" src="__PUBLIC__/Wx/js/jquery-1.9.1.js"></script>
<script type="text/javascript">
    $('.tabber span').click(function(){
        $(this).addClass("on").siblings().removeClass()
    });

    // $(".delete").click(function(){
    //     $(".notes").css('display','block');
    //     $(this).parents("li").remove();
    // });


    $(".click span").click(function(){
        if($(this).text() ==="导航"){
            $(this).text("收起");
            $('.link02').css('display','block')
        }else{
            $(this).text("导航");
            $('.link02').css('display','none')
        }//end if
    });//end fun

    function dele(obj,id){
        $.post("__MODULE__/WholesaleOrder/delete",{"id":id},function (d) {
            if(d.state>0){
                $(".inner").children('h3').text("取消失败!");
                $(".notes").css('display','block');
            }else{
                $(".notes").css('display','block');
                $(obj).parents("li").remove();
            }//end if
            $('.notes').delay(3000).hide(0);
        });//end post
    }//end fun

    function header(type) {
        $.post('__MODULE__/WholesaleOrder/index',{'type':type},function (date) {
            var div = $(date).find("div.orderlist");//获取接收的html页面中的选择部分
            $("div.orderlist").html(div);//替换掉对应html内容
        })
    }//end fun
</script>
</body>
</html>